#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
@File        :   use_chromedriver.py    
@Contact     :   18574945291@163.com
@License     :   (C)Copyright 2018-20xx, Liugroup-NLPR-CASIA
@Modify Time :   2020/12/10 18:55
@Author      :   code_wizard 1978992154@qq.com
"""

import requests
from selenium import webdriver
import os,sys
sys.path.append(os.getcwd())

LOGIN_URL = "http://www.gsxt.gov.cn/index.html"


WIN_CHROME_DRIVER_PATH = "D:\mysoft\chromedriver_66.181.exe"
LINUX_CHROME_DRIVER_PATH = '/soft_packge/chromedriver'
ENV = sys.platform

def get_driver_path():
    """
    获取当前系统环境 根据环境返回 chrome driver 的文件路径
    """
    if "win32" in ENV.strip().lower():
        return WIN_CHROME_DRIVER_PATH
    else:
        return LINUX_CHROME_DRIVER_PATH


chrome_options = webdriver.ChromeOptions()
# chrome_options.add_argument('--no-sandbox')
# chrome_options.add_argument('--disable-dev-shm-usage')
# chrome_options.add_argument('--headless')
browser_path = get_driver_path()
browser = webdriver.Chrome(browser_path, chrome_options=chrome_options)
browser.get(LOGIN_URL)